<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      console.log(myname) // undefined,预解析

      var myname = 'cxm'
      console.log(myname) //cxm

      // 函数行为 赋值 无预解析
      // myFunc() // not a function
      var myFunc = function () {
        console.log('myFuc')
      }
      myFunc()

      // 声明式  有预解析
      test()
      function test() {
        console.log('test')
      }
      test()
    </script>
  </body>
</html>
